﻿@using VocaDb.Web.Helpers
@model VocaDb.Model.DataContracts.MikuDb.InspectedAlbum

<div>
	<h3><a href="@Model.ImportedAlbum.SourceUrl">@Model.ImportedAlbum.Title</a></h3>
	@Html.HiddenFor(m => m.ImportedAlbum.Id)
	<table>
		<tr>
			<td>
				<img src="@Url.Action("CoverPicture", new { id = Model.ImportedAlbum.Id })" alt="Cover picture" class="coverPic" />
				<br /><br />	
				<p class="form-inline">
					Existing album:<br /> 
					@Html.DropDownListFor(m => m.MergedAlbumId, new SelectList(Model.ExistingAlbums, "Id", "Name", Model.MergedAlbumId), new { id = "mergedAlbumId" })
					<button id="updateAlbumBtn" type="submit" class="btn" name="commit" value="No">Update</button>
					<br />
					@if (Model.MergedAlbum != null) { 
						<span>@AlbumHelpers.AlbumLink(Model.MergedAlbum)</span>
					} else {
						<span>(no match)</span>
					}
				</p>
				<br />
				@Helpers.EntrySearchNameBox("albumSearchName")
			</td>
			<td>
				<p class="form-inline">
					Language for names:
                    @Html.LanguageSelectionDropDownListFor(m => m.SelectedLanguage, null, true)
				</p>
				@if (Model.ImportedAlbum.Data.ReleaseYear != null) {
					<p>Release year: @Model.ImportedAlbum.Data.ReleaseYear</p>
				}
				<h4>Artists</h4>
				<ul>
				@foreach (var artist in Model.Artists) {
					<li>
						@artist.Name: 
						@if (artist.ExistingArtist != null) {
							<span>@ArtistHelpers.ArtistLink(artist.ExistingArtist)</span>
						} else {
							<span>(no match)</span>
						}
					</li>
				}
				</ul>

				<h4>Tracks</h4>
				<label class="checkbox">
					@Html.CheckBoxFor(m => m.MergeTracks)					
					Merge tracks
				</label>               

				@if (Model.Tracks != null) {
				<div class="tracklist">
					<ul>
					@foreach (var track in Model.Tracks) {
						<li>
							@{ Html.RenderPartial("InspectedAlbumTrack", track); }
						</li>
					}				
					</ul>
				</div>
				} else {
					<p>No tracks will be imported.</p>
				}
			</td>
		</tr>
	</table>
</div>
